<?php 
namespace app\exam\controller;
use think\Db;
class Category extends Base{

	public function read(){
		$data=Db::table('type_name')->select();
		// print_r($data);die;
		return json_encode(['code'=>10000,'msg'=>'查询成功','data'=>$data]);

	}

	public function  search(){
	    $data=input();
        $model=model('user');
        $res=$model->getone(['login_flag'=>$data['login_flag']]);
        if($res){
            if(strpos($res['important_vip'], $data['type_id'])!==false){
//                $where['s_question']=['like',"%".$data['keyword']."%"];
//                $where1['c_decs']=['like',"%".$data['keyword']."%"];
               $res=Db::table('questiones')->where('s_question','like','%'.$data['keyword'].'%')->field('question_id,s_question')->select();
               $ret=Db::table('descquestion')->where('c_decs','like','%'.$data['keyword'].'%')->field('c_id,c_decs')->select();
               print_r($res);
               print_r($ret);

            }else{
                return json(['code'=>10001,'msg'=>'无权限']);
            }
        }else{
            return json(['code'=>10001,'msg'=>'请注册']);
        }


    }

	public function test(){
		 echo 'aaaatest';
	}





}
















 ?>